home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / inter54e.zip / INTSUM16.ZIP / INTSUM.HPP < prev    next >
C/C++ Source or Header  |  1995-10-14  |  9KB  |  257 lines

  1. //********************************************************************
  2. //  INTSUM.HPP - Data and function declarations for INTSUM app.       
  3. //                                                                    
  4. //  Written by:   Daniel D. Miller                                    
  5. //                                                                    
  6. //  Last Update:  10-14-95 12:30pm                                    
  7. //                                                                    
  8. //  Compile with makefile                                             
  9. //                                                                    
  10. //********************************************************************
  11.  
  12. #define  cur_version "1.6"
  13.  
  14. #define Version   "   Interrupt Summary Version " cur_version ", by Daniel D. Miller, Copyright (c) 1995       "
  15. #define THANKS_MESSAGE  "Thank you for using INTSUM version " cur_version " !!"
  16.  
  17. // #include <memcheck.h>
  18.  
  19. #define uchar  unsigned char
  20. #define ulong  unsigned long
  21.  
  22. #define IFF    
  23. #define THENN  ?
  24. #define ELSSE  :
  25.  
  26. #define TAB    9
  27.  
  28. //********************************************************************
  29. //  size of data buffers
  30. extern const long BFR_SIZE ;
  31.  
  32. //  size of reverse read must be smaller than size of normal
  33. //  read, so we are assured of finding current-line in our search.
  34. extern const long REV_SIZE ;
  35.  
  36. extern const int LOOP_FOREVER ;
  37.  
  38. //********************************************************************
  39. #define  IS_TRUE  != 0
  40. //lint -e723
  41. #define  IS_FALSE == 0
  42.  
  43. //********************  file-reading constants  ***********************
  44. #define  DATA_OKAY      0
  45. #define  FILE_OKAY      0
  46. // define  OUT_OF_MEMORY  1  - duplicates errorcode from above
  47. // define  BAD_FORMAT     2  - duplicates errorcode from above
  48. #define  UNUSED_CODE    3
  49. #define  OPEN_FAILED    4
  50. #define  UNKNOWN_ERROR  5
  51. #define  END_OF_FILE    6
  52.  
  53. //********************************************************************
  54. //  Block reads usually under-shoot the actual buffer size            
  55. //  by a certain amount, and that number of bytes is read             
  56. //  into a separate buffer.  The reason for that is so I can          
  57. //  search for end-of-line characters and tack them onto the          
  58. //  end of the read buffer, ensuring that each buffer always          
  59. //  contains complete lines.  This allows me to gain the speed        
  60. //  advantage of block reads, without having to deal with             
  61. //  partial lines in the program as a whole.                          
  62. //                                                                    
  63. //  The constant <UNDERSHOOT> is the number of bytes by which I       
  64. //  under-read the block read, and read separately into the line      
  65. //  buffer.  This value needs to be larger than the longest possible  
  66. //  line in the input file.                                           
  67. //********************************************************************
  68. #define UNDERSHOOT   100
  69.  
  70. //********************************************************************
  71. extern char rdtemp[UNDERSHOOT] ;
  72.  
  73. //********************************************************************
  74. //  used by one-line message functions and partial screen-clear
  75. //********************************************************************
  76. extern char spaces[121] ;  //  120 spaces long
  77.  
  78. //********************************************************************
  79. struct int_sum_line 
  80.    {
  81.    char  file ;            //  if ' ', use single list file, 
  82.                            //  else use INTERRUP.<FILE>.
  83.    // unsigned long  line ;   //  byte offset into interrupt file.
  84.    char  foffset[8] ;      //  byte offset into interrupt file
  85.    char  null_term ;       //  leave space to NULL-terminate the string
  86.    char  data[81] ;        //  data to display onscreen.
  87.    };
  88.  
  89. union sum_conv 
  90.    {
  91.    char  instr[sizeof(struct int_sum_line)] ;
  92.    struct int_sum_line idx;
  93.    };
  94. extern const unsigned last_ref_char ;
  95. extern const unsigned isl_lines ;
  96.  
  97. //*****************************************************************
  98. //  reference-file data struct
  99. //*****************************************************************
  100. struct refs
  101.    {
  102.    sum_conv *bfr[2] ; //  forward and aft parsed buffers
  103.    unsigned lines[2] ;     // number of lines of data in parsed buffers
  104.    int cur_bfr ;      //  0 or 1
  105.    unsigned offset ;  //  into current buffer
  106.    //  file pointers used by fsetpos()
  107.    long hdptr[2] ;
  108.    long tlptr[2] ;  
  109.    } ;
  110. extern refs ref ;
  111.  
  112. //*****************************************************************
  113. //  list-file data struct
  114. //*****************************************************************
  115. struct lines 
  116.    {
  117.    char instr[81] ;
  118.    };
  119.  
  120. struct lists 
  121.    {
  122.    lines *bfr[2] ; //  forward and aft parsed buffers
  123.    unsigned lines[2] ;     // number of lines of data in parsed buffers
  124.    int cur_bfr ;      //  0 or 1
  125.    unsigned offset ;  //  into current buffer
  126.    //  file pointers used by fsetpos()
  127.    long hdptr[2] ;
  128.    long tlptr[2] ;  
  129.    } ;
  130. extern lists list ;
  131.  
  132. extern const unsigned list_lines ;
  133.  
  134. //  make this global so scrolling fcns can get to it.
  135. extern FILE* lfile ;  
  136.  
  137. //*****************************************************************
  138. //  string-search data struct
  139. //*****************************************************************
  140. struct searchs
  141.    {
  142.    sum_conv *bfr ;
  143.    unsigned lines ;   // number of lines of data in parsed buffers
  144.    unsigned offset ;  // line in current buffer
  145.    //  file pointers used by fsetpos()
  146.    long hdptr ;
  147.    long tlptr ;  
  148.    } ;
  149. extern searchs search ;
  150.  
  151. //*****************************************************************
  152. //  raw-data read buffer
  153. //*****************************************************************
  154. extern char* readptr ;
  155.  
  156. //*****************************************************************
  157. //  misc data strings
  158. //*****************************************************************
  159. extern char tempstr[128] ;  //  scratchpad string
  160. extern char oldstr[128] ;   //  used by reverse_search routines
  161. extern char inipath[64] ;
  162. extern char inidrive[4] ;
  163. extern char ilpath[64] ;
  164. extern char ildrive[4] ;
  165.  
  166. //*****************************************************************
  167. extern "C" unsigned screen_rows ;
  168. extern "C" unsigned screen_cols ;
  169.  
  170. extern uchar MAIN_TEXT ;
  171. extern uchar SELECTED  ;
  172. extern uchar LOGO      ;
  173. extern uchar FILENAME  ;
  174. extern uchar MESSAGE   ;
  175. extern uchar INPUT     ;
  176. extern uchar HELP_TEXT ;
  177.  
  178. //*****************************************************************
  179. //  display structs
  180. //*****************************************************************
  181. extern const unsigned DATA_TOP ;
  182. struct vidptr
  183.    {
  184.    unsigned currow ;    //  screen offset from DATA_TOP
  185.    } ;
  186. extern vidptr ivideo ;
  187.       
  188. extern unsigned window_rows ;  //  data lines, not counting header
  189.  
  190. extern FILE* index ;
  191. //*****************************************************************
  192. //  screen text
  193. //*****************************************************************
  194. extern char* logo ;
  195. extern char* dividers ;
  196. extern char* header ;
  197. extern char* dividerd ;
  198. extern char* list_header ;
  199. extern char* list_dividerd ;
  200.  
  201. //*****************************************************************
  202. ulong make_laddr(char* instr);
  203. int  seek_next_line(FILE* infile);
  204. unsigned fill_read_buffer(FILE* infile);
  205. unsigned fill_search_buffer(FILE* infile);
  206. void build_index(void);
  207. void display_logo(void);
  208. void display_list_file(void);
  209. unsigned convert_lines(char* inbfr, unsigned rcount);
  210.  
  211. //  CONFIG.CPP
  212. int read_ini_file(void);
  213.  
  214. //  REFFILE.CPP
  215. void back_up_buffer1(void);
  216. int search_ref_buffers(char *srchstr);
  217. void search_ref_file(char *srchstr);
  218. void fill_ref_buffers(fpos_t pos);
  219. void scroll_page_up(void);
  220. void scroll_page_down(void);
  221. void display_ref_file(void);
  222. unsigned fill_ref_bfr(unsigned bfr_flag);
  223.  
  224. //  LISTFILE.CPP
  225. void process_list_file(int list_mode, char *save_file);
  226. unsigned fill_list_bfr(unsigned bfr_flag);
  227. void fill_ref_bfr_rev(void);
  228. void fill_list_bfr_rev(void);
  229. void scroll_list_down(void);
  230. void scroll_list_up(void);
  231.  
  232. //  MSGS.CPP
  233. void display_help(void);
  234. unsigned message_read(char* msg_str, char* instr);
  235. void message_show(char* msg_str);
  236.  
  237. //  STRSTRI.ASM
  238. extern "C" int strstri(const char far* str1, const char far* str2);
  239.  
  240. //  DVIDEO.ASM
  241. extern "C" {
  242. void home_cursor(void);
  243. uchar get_char_attr(void) ;
  244. void mark_cursor_line(unsigned row, uchar attr) ;
  245. void get_vsize(void) ;
  246. void select_video_seg(unsigned vseg) ;
  247. unsigned get_video_seg(void) ;
  248. void clear_display(uchar cattr) ;
  249. void dgotoxy(unsigned x, unsigned y) ;
  250. void dprintc(unsigned x, unsigned y, uchar attr, char outchr) ;
  251. void dprints(unsigned x, unsigned y, uchar attr, char* outstr) ;
  252. void hide_cursor(void);
  253. unsigned get_key(void);
  254. int  key_hit(void);
  255. }
  256.  
  257.